home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / networking / misc / sana2.lha / sana2 / examples / waitforonline / waitforonline.c < prev   
Encoding:
C/C++ Source or Header  |  1991-11-18  |  996 b   |  51 lines

  1. /*
  2. **  $Id: waitforonline.c,v 1.2 91/11/13 11:15:04 dlarson Exp $
  3. **
  4. **  SANA-II driver utility -- Wait for a driver to come online.
  5. **                  (No wait if driver already online.)
  6. **
  7. **  Copyright 1991 Commodore-Amiga, Inc.
  8. **
  9. **  This code may be modified and used freely on Amiga computers.
  10. **
  11. */
  12.  
  13.  
  14. #define NOBUFFS 1
  15. #include "/skeleton/skeleton.h"
  16.  
  17. struct MsgPort   *DevPort = NULL;
  18. struct IOSana2Req *IOB1    = NULL;
  19.  
  20. int    DeviceOpen = 0;
  21. long   DevBits;
  22.  
  23. void WaitForOnLine();
  24.  
  25. main(argc , argv)
  26. char *argv[];
  27. {
  28.     if(!initdev())
  29.         printf("Open Failed\n");
  30.     else
  31.     {
  32.         printf("Waiting For OnLine\n");
  33.         WaitForOnLine();
  34.         if(IOB1->ios2_Req.io_Error)
  35.             printf("ERROR CODE: 0x%lx\n",
  36.                 (long)IOB1->ios2_Req.io_Error);
  37.         else
  38.             printf("OnLine Occurred - No Error\n");
  39.     }
  40. bottom:    closedev();
  41. }
  42.  
  43. void WaitForOnLine()
  44. {
  45.     IOB1->ios2_Req.io_Error     = 0;
  46.     IOB1->ios2_Req.io_Flags     = IOF_QUICK;
  47.     IOB1->ios2_Req.io_Command   = S2_ONEVENT;
  48.     IOB1->ios2_WireError = S2EVENT_ONLINE;
  49.     DoIO(IOB1);
  50. }
  51.